<template>
	<view class="content">
		
		<view class="topBg">
			
		</view>
		<view class="card" v-for="item in houseList" :key="item.id" @click="navigate(item)">
			<view class="state">
				<image src="../../static/houseProperty_type/type_1.png" mode=""></image>
				<view class="" v-if="item.isInProjectProcess||!item.isPayment">
					{{!item.isPayment?'未缴费':'维修中'}}
				</view>
			</view>
			
			<view class="name">
				{{item.communityName}}
			</view>
			<view class="explain">
				{{item.floor}}#{{item.unit}}单元{{item.name}}
			</view>
			
			<view class="btn">
				{{!item.isPayment?'缴费':'查看'}}
			</view>
		</view>
		
		<view class="add-house-btn" @click="addNav">
			添加房产
		</view>
		
		<Loading/>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				houseList:[]
			}
		},
		onLoad() {
			this.$myRequest('/api/houses').then(res=>{
				this.houseList=res.data
				// this.$myRequest('/api/houses/GetHouseInProjectProcess/dbdb76b8-0223-46cc-99e6-a1386ea36141')
				
			})
		},
		methods: {
			navigate(item){

				uni.navigateTo({
					url:'/pages/houseProperty/payHouseProperty/payHouseProperty?id='+item.id
				})
			},
			addNav(){
				uni.navigateTo({
					url:'/pages/houseProperty/addhouseProperty/addhouseProperty'
				})
			}
		}
	}
</script>

<style lang="scss">
	.content{
		background-color: #F5F5F5;
		padding: 185rpx 40rpx 140rpx 40rpx;
		min-height: calc(100vh - 325rpx);
	}
	.topBg{
		background-image: linear-gradient(42deg,#3E60FC,#65ADFF);
		position: fixed;
		top: 0;
		left: 0;
		width: 100vw;
		height: 160rpx;
		z-index: 99;
	}
	.card{
		padding: 20rpx;
		height: 188rpx;
		margin-bottom: 26rpx;
		position: relative;
		.state{
			display: flex;
			align-items: center;
			color: #FC5E53;
			font-size: 28rpx;
			margin-bottom: 28rpx;
			image{
				width: 40rpx;
				height: 40rpx;
				margin-right: 12rpx;
			}
		}
		.name{
			font-size: 28rpx;
			color: #333333;
			font-weight: 700;
		}
		.explain{
			font-size: 28rpx;
			color: #666666;
			margin-top: 20rpx;
		}
		.btn{
			background: #456FFD;
			width: 166rpx;
			height: 58rpx;
			border-radius: 58rpx;
			color: #ffffff;
			line-height: 58rpx;
			text-align: center;
			position: absolute;
			right: 16rpx;
			bottom: 20rpx;
			font-size: 28rpx;
		}
	}

  .add-house-btn{
		width: 408rpx;
		height: 80rpx;
		background-color: #FC5E53;
		line-height: 80rpx;
		text-align: center;
		font-size: 28rpx;
		color: #ffffff;
		border-radius: 16rpx;
		position: fixed;
		left: 50%;
		transform: translateX(-50%);
		bottom: 40rpx;
		z-index: 9;
	}
</style>
